
/*
*/

function JSTest_verifyCert()
{	

 
			if(localCacheICert==null)
			{
				alert("找不到证书");
				return;
			}
	 
	        var flag=0;
	        if(verifyCertOption1.checked==true)
			{
			    flag|=parseInt(verifyCertOption1.value);
			}
           	if(verifyCertOption2.checked==true)
			{
			    flag|=parseInt(verifyCertOption2.value);
			}
			if(verifyCertOption3.checked==true)
			{
			    flag|=parseInt(verifyCertOption3.value);
			}
			 if(verifyCertOption4.checked==true)
			{
			    flag|=parseInt(verifyCertOption4.value);
			}
			if(verifyCertOption5.checked==true)
			{
			    flag|=parseInt(verifyCertOption5.value);
			}
		  
 
            /*
            验证证书使用NETCAPKI verifyCert方法
            */
			var certstatus=NetcaPKI.verifyCert(localCacheICert,flag); 
			var str="";

            if(NetcaPKI.getLastError()!=NetcaPKI.OK)
			{
				alert(NetcaPKI.getLastErrorMsg());
				return;
			} 

			if(certstatus==NetcaPKI.CERT_STATUS_UNREVOKED) 
			{
				str="证书有效";
			}
				if(certstatus==NetcaPKI.CERT_STATUS_UNDETERMINED) 
			{
				str="证书的状态不能确定";
			}
				if(certstatus==NetcaPKI.CERT_STATUS_REVOKED) 
			{
				str="证书已作废";
			}
			
			if(certstatus==NetcaPKI.CERT_STATUS_CA_REVOKED) 
			{
				str="上级CA证书已作废";
			}
				
			if(certstatus==NetcaPKI.CERT_STATUS_NOT_IN_VALIDITY) 
			{
				str="证书不在有效期内";
			}
			
				
			if(certstatus==NetcaPKI.CERT_STATUS_BULID_CERTPAT_FAIL) 
			{
				str="没有安装证书链";
			}
				
			if(certstatus==NetcaPKI.CERT_STATUS_VERIFY_CERTPATH_FAIL) 
			{
				str="验证证书链失败";
			}
			
			if(certstatus==NetcaPKI.CERT_STATUS_NO_REVOKE_INFO) 
			{
				str="没有合适的作废信息";
			}
			if(certstatus==NetcaPKI.CERT_STATUS_ON_HOLD) 
			{
				str="证书已挂失";
			}


			alert(str);


	}